<script setup>
  import {ajax} from 'framework'
  const model=defineModel()
  const {type,rank} =defineProps({
    type:{
      type:String,
      description:'类型',
      default:'01'
    },
    rank:{
      type:[String, Number],
      description:"向后取rank级",
      default:3
    }
  })
  const option={
    keyName:'sn',
    titleName:'name',
    parentName:'parentSn',
    dataMode:'list',
    getTotalDatas(resolve){
      ajax.get("system/multiDict",{type:type+"%", rank}).then(_=>resolve(_.data))
    },

    // getDatas(parent,resolve){
    //   if (parent){
    //     if (parent.subCount==0){
    //       resolve([])
    //     }else{
    //       ajax.get("system/multiDict",{type:parent.sn}).then(_=>resolve(_.data))
    //     }
    //   }else{
    //     ajax.get("system/multiDict",{type:type}).then(_=>resolve(_.data))
    //   }
    //
    // }
  }
</script>
<template>
  <CategoryPicker v-model="model" :option="option"/>
</template>
